package date;

public class Date {
    int month, day, year;
    Date(String new_date){
        String[] res = new_date.split(" ");
        month = monthTF(res[0]);
        day = Integer.parseInt(res[1].replace(",",""));
        year = Integer.parseInt(res[2]);
    }
    Date(String new_month, int new_day, int new_year){
        month = monthTF(new_month);
        day = new_day;
        year = new_year;
    }
    Date(int new_year, int new_month, int new_day){
        month = new_month;
        day = new_day;
        year = new_year;
    }
    String print(){
        return String.format("%d/%02d/%02d", year, month, day);
    }
    int monthTF(String new_month){
        String[] months = {"Jan.", "Feb.", "Mar.", "Apr.", "May.", "Jun.", "Jul.", "Aug.", "Sept.", "Oct.", "Nov.", "Dec."};
        int result;
        for(result = 1; result < 12; result++){
            if (new_month.equals(months[result-1])){
                break;
            }
        }
        return result;
    }
}
